package com.yicheng.statistics

import akka.actor.{ActorSystem, Props}
import com.typesafe.config.ConfigFactory
import com.yicheng.statistics.actor.HtaRouting
import com.yicheng.statistics.common.AlarmDB
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.collection.JavaConversions._
import scala.concurrent.Await
import scala.util.Success
import scala.util.Failure
import com.yicheng.statistics.actor.DaemonActor

/**
  * Created by yuer on 2016/11/28.
  * 从数据库查询出所有设备进行对每个设备进行报警分析
  */
object HtaServer {
  def main(args: Array[String]) {
    val config = ConfigFactory.load()
    val actorSystem = ActorSystem("HtaServer")
    val routing = actorSystem.actorOf(Props[HtaRouting], "routing")
    actorSystem.actorOf(Props[DaemonActor],"daemon")
      //取设备信息
//    AlarmDB.queryDeviceIdByTable() onComplete {
//      case Success(result) =>
//        result foreach (
//            d => {
//              routing ! (d._1, d._2)
//            }
//            
//        )// tbox
//      case Failure(error) =>
//          println(error.getStackTrace.toString())
//    }
    routing !("LA6N6CA58HB202820", 100)
  }
}
